#!/bin/bash


make scripts
tar czvf scripts.tar.gz ./scripts/
find ./ -name '*.c' -type f -print -exec rm -rf {} \;
find ./ -name '*.o' -type f -print -exec rm -rf {} \;
find ./ -name '*.a' -type f -print -exec rm -rf {} \;
find ./ -name '*.so' -type f -print -exec rm -rf {} \;
find ./ -name '*.ko' -type f -print -exec rm -rf {} \;
find ./ -name '*.S' -type f -print -exec rm -rf {} \;
find ./ -name '*.cmd' -type f -print -exec rm -rf {} \;
rm ./.tmp_vmlinux1
rm ./.tmp_vmlinux2
rm arch/arm/boot/*mage
rm -rf arch/arm/boot/dts
rm vmlinux

shopt -s extglob
rm -rf !(Makefile|arch|include|scripts|scripts.tar.gz|tools|Module.symvers|modules|modules.builtin|modules.order) 
tar xvf scripts.tar.gz 
rm scripts.tar.gz
cd arch
rm -rf !(arm64) 


